package com.example.demotool;

import com.example.demotool.servlet.VerifyServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@MapperScan("com.example.demotool.mapper")
@EnableScheduling
@EnableCaching
public class DemoToolApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoToolApplication.class, args);
    }

    /**
     * 验证码servlet
     * @return
     */
    @Bean
    public ServletRegistrationBean indexServletRegistration(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new VerifyServlet());
        servletRegistrationBean.addUrlMappings("/getVerifyCode");
        return servletRegistrationBean;
    }
}
